import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
import type { ReactElement } from "react";
import Login from '@/pages/Login';
import NotFound from '@/pages/Error/404';
import Admin from '@/components/Admin';
import Auth from '@/components/Auth';
import AdminUser from "@/pages/AdminUser/Panel"
import WhiteRegister from '@/pages/WhiteRegister/Panel'
import WhiteDevice from '@/pages/WhiteDevice/Panel'
import WhiteAudit from '@/pages/WhiteAudit/Panel'
import WithdrawGear from '@/pages/WithdrawGear/Panel'
import WithdrawChannel from '@/pages/WithdrawChannel/Panel'
import Version from '@/pages/Version/Panel'
import Ranking from '@/pages/Ranking/Panel'
import SettingCountry from '@/pages/SettingCountry/Panel'
import Notice from '@/pages/Notice/Panel'
import GameClassify from '@/pages/GameClassify/Panel'
import Game from '@/pages/Game/Panel'
import SearchUser from '@/pages/SearchUser/Panel'
import UserFlow from '@/pages/UserFlow/Panel'
import TotalUser from '@/pages/TotalUser/Panel'
import TotalSum from '@/pages/TotalSum/Panel'
import TotalNews from '@/pages/TotalNews/Panel'
import TotalRetention from '@/pages/TotalRetention/Panel'
import Rerun from '@/pages/Rerun/Panel'
import UserExport from '@/pages/UserExport/Panel'
import TotalDateExport from '@/pages/TotalDateExport/Panel'
import WhiteHold from '@/pages/WhiteHold/Panel'
import WithdrawRecord from '@/pages/WithdrawRecord/Panel'

function App():ReactElement {
  return (
    <BrowserRouter>
      <Routes>
        <Route path='/login' element={<Login />} />
        <Route path='/' element={<Auth><Admin /></Auth>}>
          <Route index element={<Navigate to='/user-search' replace />} />
          <Route path='/admin-user' element={<AdminUser />} />
          <Route path='/white-register' element={<WhiteRegister />} />
          <Route path='/white-device' element={<WhiteDevice />} />
          <Route path='/white-audit' element={<WhiteAudit />} />
          <Route path='/withdraw-gear' element={<WithdrawGear />} />
          <Route path="/withdraw-channel" element={<WithdrawChannel />} />
          <Route path="/version-list" element={<Version />} />
          <Route path="/ranking-list" element={<Ranking />} />
          <Route path="/setting-country" element={<SettingCountry />} />
          <Route path="/notice-list" element={<Notice />} />
          <Route path="/minigame-classify" element={<GameClassify />} />
          <Route path="/minigame-list" element={<Game />} />
          <Route path="/user-search" element={<SearchUser />} />
          <Route path="/user-flow" element={<UserFlow />} />
          <Route path="/total-user" element={<TotalUser />} />
          <Route path="/total-sum" element={<TotalSum />} />
          <Route path="/total-news" element={<TotalNews />} />
          <Route path="/total-retention" element={<TotalRetention />} />
          <Route path="/total-rerun" element={<Rerun />} />
          <Route path="/user-export" element={<UserExport />} />
          <Route path="/totla-date-export" element={<TotalDateExport />} />
          <Route path="/white-hold" element={<WhiteHold />} />
          <Route path="/withdraw-record" element={<WithdrawRecord />} />
        </Route>
        <Route path='*' element={<NotFound />} />
      </Routes>
    </BrowserRouter>
  )
}

export default App
